package com.scsj.supermarket.view.activity.settingmodel;

import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.scsj.supermarket.R;
import com.scsj.supermarket.config.RxSPConfig;
import com.scsj.supermarket.utils.SkipUtils;
import com.scsj.supermarket.utils.ToastMiddleUtils;
import com.scsj.supermarket.view.activity.baseactivitymodel.BaseActivity;
import com.vondear.rxtools.RxSPTool;

/**
 * 新设置页面
 */
public class NewSettingActivity extends BaseActivity implements View.OnClickListener {
    private RelativeLayout mPersonalInformationRl;
    private RelativeLayout mChangePhonenumRl;
    private RelativeLayout mSocialAccountBindingRl;
    private RelativeLayout mLoginPasswordRl;
    private RelativeLayout mPaymentSettingsRl;
    private RelativeLayout mGeneralSettingsRl;
    private RelativeLayout mAboutOusRl;
    private RelativeLayout mLogoutAccountRl;
    private TextView mToolbarTitle;
    private Toolbar mToolbar;

    @Override
    protected void createView(Bundle savedInstanceState) {
        setContentView(R.layout.activity_set);
        //ScreenAdapterTools.getInstance().loadView((ViewGroup) getWindow().getDecorView());
        //ScreenAdapterTools.getInstance().reset(this);//如果希望android7.0分屏也适配的话,加上这句
        initToolbar();
        setToolbarTitle("设置");
        hasBack(true);
    }

    @Override
    protected void initView() {

        mPersonalInformationRl = (RelativeLayout) findViewById(R.id.personal_information_rl);
        mPersonalInformationRl.setOnClickListener(this);
        mChangePhonenumRl = (RelativeLayout) findViewById(R.id.change_phonenum_rl);
        mChangePhonenumRl.setOnClickListener(this);
        mSocialAccountBindingRl = (RelativeLayout) findViewById(R.id.social_account_binding_rl);
        mSocialAccountBindingRl.setOnClickListener(this);
        mLoginPasswordRl = (RelativeLayout) findViewById(R.id.login_password_rl);
        mLoginPasswordRl.setOnClickListener(this);
        mPaymentSettingsRl = (RelativeLayout) findViewById(R.id.payment_settings_rl);
        mPaymentSettingsRl.setOnClickListener(this);
        mGeneralSettingsRl = (RelativeLayout) findViewById(R.id.general_settings_rl);
        mGeneralSettingsRl.setOnClickListener(this);
        mAboutOusRl = (RelativeLayout) findViewById(R.id.about_ous_rl);
        mAboutOusRl.setOnClickListener(this);
        mLogoutAccountRl = (RelativeLayout) findViewById(R.id.logout_account_rl);
        mLogoutAccountRl.setOnClickListener(this);
        mToolbarTitle = (TextView) findViewById(R.id.toolbar_title);
        mToolbar = (Toolbar) findViewById(R.id.toolbar);
    }

    @Override
    protected void initListener() {

    }

    @Override
    protected void initData() {

    }


    @Override
    public void onClick(View v) {
        switch (v.getId()) {

            case R.id.personal_information_rl://个人信息
                SkipUtils.toPersonalInformation(this);
                break;
            case R.id.change_phonenum_rl://换绑手机号，跳转到手机验证身份页面
                SkipUtils.toAuthentication(this);
                break;
            case R.id.social_account_binding_rl:
                SkipUtils.toAccountBinding(this);
                break;
            case R.id.login_password_rl:
                SkipUtils.toChangeLoginPsw(this);
                break;
            case R.id.payment_settings_rl://payment_settings_rl
                SkipUtils.toPaymentSettings(this);
                break;
            case R.id.general_settings_rl:
                SkipUtils.toGeneralSettings(this);
                break;
            case R.id.about_ous_rl:
                SkipUtils.toAboutOus(this);
                break;
            case R.id.logout_account_rl:
                ToastMiddleUtils.ToastMiddle(this,"退出登录");
                RxSPTool.putBoolean(this, RxSPConfig.IS_LOGIN,false);
                break;
            default:
                break;
        }
    }
}
